﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>服务器检测</title>
    <script src="http://img1.c2cedu.com/Scripts/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="http://files.cnblogs.com/lori/jquery.jsonp-2.3.0.min.js" type="text/javascript"></script>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function getDate() {
            var d, s, t;
            d = new Date();
            s = d.getFullYear().toString(10).slice(-2) + "-";
            t = d.getMonth() + 1;
            s += (t > 9 ? "" : "0") + t + "-";
            t = d.getDate();
            s += (t > 9 ? "" : "0") + t + " ";
            t = d.getHours();
            s += (t > 9 ? "" : "0") + t + ":";
            t = d.getMinutes();
            s += (t > 9 ? "" : "0") + t + ":";
            t = d.getSeconds();
            s += (t > 9 ? "" : "0") + t;
            return s;
        }

        function testIIS(name, url) {
            $.ajax({
                type: "GET",
                dataType: "jsonp",
                cache: false,
                url: url,
                jsonp: "jsonpcallback",
                beforeSend: function (data) {
                    $("#iis" + name).html("<font color=red>Fail</font>");
                    $("#db" + name).html("<font color=red>Fail</font>");
                    $("#server" + name).html(data.Server);
                    $("#time" + name).html(getDate());
                    $("#servername" + name).html(data.ServerName);
                },
                error: function (data) {
                },
                success: function (data) {
                    $("#server" + name).html(data.Server);
                    $("#iis" + name).html("<font color=green>" + data.IISMessage + "</font>");
                    $("#db" + name).html("<font color=green>" + data.DBMessage + "</font>");
                    $("#servername" + name).html(data.ServerName);
                    $("#time" + name).html(getDate());
                }
            })
        }
        // 测试服务器1
        function test1() {
            testIIS(1, "http://test.eee114.com/test/testiis");
            setTimeout("test1()", 5000);

        }
        function timer() {
            $("#timer").html(getDate())
            setTimeout("timer()", 1000);
        }
        // 调用测试方法
        $(function () {
            test1();
            timer();
        });

        
       
    </script>
</head>
<body>
    <!--banner区-->
    <div class="banner">
        <h1>
            网站服务器追踪</h1>
    </div>
    <div class="clear">
    </div>
    <!--msg区-->
    <div class="msg">
        时间：<span id="timer"></span>
    </div>
    <div class="clear">
    </div>
    <!--list区-->
    <div class="list">
        <table width="800" border="0" cellpadding="0" cellspacing="0">
            <tr class="list_tit">
                <td>
                    网站名称
                </td>
                <td>
                    IP地址
                </td>
                <td>
                    IIS
                </td>
                <td>
                    数据库
                </td>
                <td>
                    更新时间
                </td>
            </tr>
            <tr class="list_tit_con">
                <td id="servername1">
                </td>
                <td id="server1">
                </td>
                <td class="red" id="iis1">
                </td>
                <td class="red" id="db1">
                </td>
                <td id="time1">
                </td>
            </tr>
        </table>
    </div>
    <div class="clear">
    </div>
    <div class="footer">
        清大世纪 技术部</div>
    <div class="clear">
    </div>
</body>
</html>
